<extend name="layout:index"/>

<block name="content">
	<div class="mws-panel grid_8">
    	<div class="mws-panel-header">
        	<span>管理中心-会员账户调节</span>
        </div>
        <div class="mws-panel-body no-padding">
        	<form class="mws-form" action="/admin/user/update" method="post">
        		<input type="hidden" name="user_id" value="{$user_id}">
        		<input type="hidden" name="user_name" value="{$user_name}">
        		<div class="mws-form-inline">
		  			<div class="mws-form-row">
        				<label class="mws-form-label">当前会员</label>
        				<div class="mws-form-item">
        					<input class="small" type="text" value="{$user_name}" disabled>
        				</div>
        			</div>
        			<div class="mws-form-row">
        				<label class="mws-form-label">账户变动原因</label>
        				<div class="mws-form-item">
        					<textarea rows="" cols="" name="change_desc" class="small"></textarea>
        				</div>
        			</div>
        			<div class="mws-form-row">
        				<label class="mws-form-label">现金积分</label>
        				<div class="mws-form-item">
        				<select  width="50" name="hao1">
        						<option value="1">增加</option>
        						<option value="-1">减少</option>
        					</select>　
        					<input width="200" type="text"  id="user_money1" value="0" name="user_money1">　　当前值：{$res.user_money1}
        				</div>
        			</div>
        			<div class="mws-form-row">
        				<label class="mws-form-label">注册积分</label>
        				<div class="mws-form-item">
        				<select  width="50" name="hao2">
        						<option value="1">增加</option>
        						<option value="-1">减少</option>
        					</select>　
        					<input width="200"  type="text" id="user_money2" value="0" name="user_money2">　　当前值：{$res.user_money2}
        				</div>
        			</div>
        			<div class="mws-form-row">
        				<label class="mws-form-label">认购积分</label>
        				<div class="mws-form-item">
        				<select  width="50" name="hao3">
        						<option value="1">增加</option>
        						<option value="-1">减少</option>
        					</select>　
        					<input width="200"  type="text" id="user_money3" value="0" name="user_money3">　　当前值：{$res.user_money3}
        				</div>
        			</div>
        			<div class="mws-form-row">
        				<label class="mws-form-label">商城积分</label>
        				<div class="mws-form-item">
        				<select  width="50" name="hao4">
        						<option value="1">增加</option>
        						<option>减少</option>
        					</select>　
        					<input width="200"  type="text" id="user_money4" value="0" name="user_money4">　　当前值：{$res.user_money4}
        				</div>
        			</div>
        			<div class="mws-form-row">
        				<label class="mws-form-label">E积分</label>
        				<div class="mws-form-item">
        				<select name="hao5"  width="50">
        						<option value="1">增加</option>
        						<option value="-1">减少</option>
        					</select>　
        					<input width="200"  type="text" id="option_num" value="0" name="option_num">　　当前值：{$res.option_num}
        				</div>
        			</div>
        		</div>
        		<div class="mws-button-row">
        			<input value="确定" id="btn4" class="btn btn-danger" type="submit">
        			<input value="重置" class="btn " type="reset">
        		</div>
        	</form>
        </div>    	
    </div>


    <script>
    	$("#btn4").click(function(){
    		var change_desc = $('textarea').val();
    		var user_money1 = $('#user_money1').val();
    		var user_money2 = $('#user_money2').val();
    		var user_money3 = $('#user_money3').val();
    		var user_money4 = $('#user_money4').val();
    		var option_num = $('#option_num').val();
    		//判断账户变动原因
    		if(change_desc == ''){
				var txt=  "变动原因不能为空";
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				return false;
    		}
    		//判断现金积分
    		if(!isNaN(user_money1)){
    			if(user_money1 == ''){
					var txt=  "现金积分不能为空";
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
					return false;
				}
    		}else{
    			var txt=  "现金积分不能为除数字以外的字符";
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				return false;
    		}
    		//判断注册积分
    		if(!isNaN(user_money2)){
    			if(user_money2 == ''){
					var txt=  "注册积分不能为空";
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
					return false;
				}
    		}else{
    			var txt=  "注册积分不能为除数字以外的字符";
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				return false;
    		}
			//判断认购积分
			if(!isNaN(user_money3)){
    			if(user_money3 == ''){
					var txt=  "认购积分不能为空";
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
					return false;
				}
    		}else{
    			var txt=  "认购积分不能为除数字以外的字符";
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				return false;
    		}
    		//判断商城积分
    		if(!isNaN(user_money4)){
    			if(user_money4 == ''){
					var txt=  "商城积分不能为空";
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
					return false;
				}
    		}else{
    			var txt=  "商城积分不能为除数字以外的字符";
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				return false;
    		}
    		//判断E积分
    		if(!isNaN(option_num)){
    			if(option_num == ''){
					var txt=  "E积分不能为空";
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
					return false;
				}
    		}else{
    			var txt=  "E积分不能为除数字以外的字符";
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				return false;
    		}
		});
    </script>
</block>